package com.learn.my;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class Test0004 {


    public static void main(String[] args){

        //可固定长度线程池
        Executor newFixedThreadPool =Executors.newFixedThreadPool(3);

        for (int i = 0; i < 20; i++) {
            final  int temp=i;
            newFixedThreadPool.execute(new Runnable() {
                public void run() {
                    System.out.println(Thread.currentThread().getName()+","+temp);
                }
            });
        }
    }
}
